home *** CD-ROM | disk | FTP | other *** search
- ATARI MACHINE SPECIFIC LIBRARY
-
-
-
- NAME
- BlockMap - display of block-based graphics
-
- SYNOPSIS
- #include <BlockMap.h>
-
- class BlockMap
-
- class BlockImages
- class ColourBlockImages
- class WideColourBlockImages
- class MonochromeBlockImages
- class WideMonochromeBlockImages
-
- class BlockMapView
-
- DESCRIPTION
- A very large number of existing programs construct the screen display
- from a grid of square images (blocks). This modules provides for the
- map which makes up the whole area of blocks (BlockMap), for various
- kinds of images used for the blocks (BlockImages), and for the
- rectangular view of a BlockMap (BlockMapView).
-
- CLASSES
- class BlockMap
- A rectangular matrix of characters or short integers.
-
- class BlockImages
- Lists of rectangular images.
-
- class ColourBlockImages - 16xH in 16 colours
- class WideColourBlockImages - 32xH in 16 colours
- class MonochromeBlockImages - 16xH in 1 colour
- class WideMonochromeBlockImages - 32xH in 1 colour
-
- class BlockMapView
- A view of a BlockMap, where the char/short are interpretted as
- indices into a BlockImages.
-
- CLASS MEMBERS
- BlockMap::
- BlockMap(short w, short h, int MaxBlockImages=256)
- Create a BlockMap with the given dimensions, and capable of
- storing the given number of values at each position.
- The BlockMap class intelligently uses char or short representations
- for the elements of the map to save on memory.
-
- short operator() (short x, short y)
- short operator() (Point& P) { return operator()(P.x,P.y) }
- Return the value at (x,y) in the map.
-
- void Set(short x, short y, short ch)
- void Set(Point& P, short ch) { Set(P.x,P.y,ch) }
- Set the value at (x,y) in the map.
-
- bool Includes(short x, short y)
- bool Includes(Point& P) { return Includes(P.x,P.y) }
- TRUE if the given (x,y) is in the map.
-
- int fput(FILE *fp)
- int fget(FILE *fp)
- Input/Output [NOT IMPLEMENTED]
-
- BlockMap(short w, short h, char *map)
- BlockMap(short w, short h, short *map)
- Create a BlockMap from an existing 2-dimensional array.
- eg.
- short Map[64][64];
- BlockMap Bmap(64,64,Map[0]);
-
- These constructors are of limited value, since the existing
- array should not be directly accessed anyway, since this
- defeats the incremental update facilities of BlockMapViews.
-
- BlockImages::
- ColourBlockImages::
- WideColourBlockImages::
- MonochromeBlockImages::
- WideMonochromeBlockImages::
-
- ColourBlockImages(short MaxBlocks, short Height)
- WideColourBlockImages(short MaxBlocks, short Height)
- MonochromeBlockImages(short MaxBlocks, short Height)
- WideMonochromeBlockImages(short MaxBlocks, short Height)
- Create a BlockImages capable of defining the given number of
- blocks, each of the given height.
- (Note that no public constructors exist for plain
- BlockImages, as it is an abstract class)
-
- void GetImages(short c, int num, Screen&)
- Get num images, starting with image c, from the given screen.
- Images are taken from consecutive positions on the screen -
- eg. for 16x14 colour images taken from a STLow screen, 20
- are taken from the first strip of 14 lines, then the
- next 20 are taken from the next strip, etc. (20 images
- that are 16 pixels wide fit across a 320 pixel screen).
-
- virtual void GetImage(short c, int x, int y, Screen&)
- virtual void GetImage(short c, Point& P, Screen&)
- Lower level version of the above routine. Get image c in the
- list from the given (x,y) position on the given Screen.
-
- BlockMapViews::
- BlockMapView(BlockMap& m, BlockImages& Im,
- short sx, short sy, short w, short h,
- short x=0, short y=0)
-
- Position the view at pixel (sx,sy) on screen (determined by Pages,
- see DoubleBuffer for details), w by h blocks in size, viewing (x,y)
- in the given map by using the given BlobkImages for display.
-
- void Views(short x, short y)
- void Views(Point& P)
- View the area at (x,y) in the map.
-
- void Resize(short w, short h)
- Change the size of the view (in blocks).
-
- void ViewsArea(Rectangle R)
- Change both the position and area of the view.
- (combines two previous operations)
-
- void MoveView(short sx, short sy)
- void MoveView(Point P)
- Change the screen-view position of the map.
-
- void ViewsMap(BlockMap& m)
- Change the map being viewed.
-
- void ViewsImages(BlockImages& Im)
- Change the images used to display the map.
-
- void Draw()
- Incrementally draw the map (ie. only draw the changed parts).
-
- USAGE
- 1. Create a BlockMap.
- 2. Create a BlockImages.
- 3. Create a BlockMapView from these two.
- 4. Call the Draw() method in the main animation loop. (see DoubleBuffer)
-
- FILES
- I/O is not currently implemented.
-
- SEE ALSO
- Screen
-
- AUTHOR
- Warwick Allison, 1992.
- warwick@cs.uq.oz.au
-
- COPYING
- This functionality is part of the Atari Machine Specific Library,
- and is Copyright 1992 by Warwick W. Allison.
-
- The Atari Machine Specific Library is free and protected under the
- GNU Library General Public License.
-
- You are free to copy and modify these sources, provided you acknowledge
- the origin by retaining this notice, and adhere to the conditions
- described in the GNU LGPL.
-